﻿using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a surface model.</summary>
	// Token: 0x02000068 RID: 104
	[Serializable]
	public class HSurfaceModel : HHandle, ISerializable, ICloneable
	{
		// Token: 0x0600187F RID: 6271 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HSurfaceModel() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x06001880 RID: 6272 RVA: 0x0009CCA2 File Offset: 0x0009AEA2
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HSurfaceModel(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06001881 RID: 6273 RVA: 0x0009CCB1 File Offset: 0x0009AEB1
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HSurfaceModel(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06001882 RID: 6274 RVA: 0x0009CCC0 File Offset: 0x0009AEC0
		private void AssertSemType()
		{
			base.AssertSemType("surface_model");
		}

		// Token: 0x06001883 RID: 6275 RVA: 0x0009CCCD File Offset: 0x0009AECD
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HSurfaceModel obj)
		{
			obj = new HSurfaceModel(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x06001884 RID: 6276 RVA: 0x0009CCE8 File Offset: 0x0009AEE8
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HSurfaceModel[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HSurfaceModel[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HSurfaceModel(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Read a surface model from a file.
		///   Modified instance represents: Handle of the read surface model.
		/// </summary>
		/// <param name="fileName">Name of the SFM file.</param>
		// Token: 0x06001885 RID: 6277 RVA: 0x0009CD58 File Offset: 0x0009AF58
		public HSurfaceModel(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1039);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create the data structure needed to perform surface-based matching.
		///   Modified instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model.</param>
		/// <param name="relSamplingDistance">Sampling distance relative to the object's diameter Default: 0.03</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		// Token: 0x06001886 RID: 6278 RVA: 0x0009CDA4 File Offset: 0x0009AFA4
		public HSurfaceModel(HObjectModel3D objectModel3D, double relSamplingDistance, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1044);
			HalconAPI.Store(proc, 0, objectModel3D);
			HalconAPI.StoreD(proc, 1, relSamplingDistance);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
		}

		/// <summary>
		///   Create the data structure needed to perform surface-based matching.
		///   Modified instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model.</param>
		/// <param name="relSamplingDistance">Sampling distance relative to the object's diameter Default: 0.03</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		// Token: 0x06001887 RID: 6279 RVA: 0x0009CE1C File Offset: 0x0009B01C
		public HSurfaceModel(HObjectModel3D objectModel3D, double relSamplingDistance, string genParamName, string genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1044);
			HalconAPI.Store(proc, 0, objectModel3D);
			HalconAPI.StoreD(proc, 1, relSamplingDistance);
			HalconAPI.StoreS(proc, 2, genParamName);
			HalconAPI.StoreS(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
		}

		// Token: 0x06001888 RID: 6280 RVA: 0x0009CE88 File Offset: 0x0009B088
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = this.SerializeSurfaceModel();
			byte[] value = hserializedItem;
			hserializedItem.Dispose();
			info.AddValue("data", value, typeof(byte[]));
		}

		// Token: 0x06001889 RID: 6281 RVA: 0x0009CEC0 File Offset: 0x0009B0C0
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HSurfaceModel(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = new HSerializedItem((byte[])info.GetValue("data", typeof(byte[])));
			this.DeserializeSurfaceModel(hserializedItem);
			hserializedItem.Dispose();
		}

		/// <summary>Serialize object to binary stream in HALCON format</summary>
		// Token: 0x0600188A RID: 6282 RVA: 0x0009CF00 File Offset: 0x0009B100
		public new void Serialize(Stream stream)
		{
			HSerializedItem hserializedItem = this.SerializeSurfaceModel();
			hserializedItem.Serialize(stream);
			hserializedItem.Dispose();
		}

		/// <summary>Deserialize object from binary stream in HALCON format</summary>
		// Token: 0x0600188B RID: 6283 RVA: 0x0009CF14 File Offset: 0x0009B114
		public new static HSurfaceModel Deserialize(Stream stream)
		{
			HSurfaceModel hsurfaceModel = new HSurfaceModel();
			HSerializedItem hserializedItem = HSerializedItem.Deserialize(stream);
			hsurfaceModel.DeserializeSurfaceModel(hserializedItem);
			hserializedItem.Dispose();
			return hsurfaceModel;
		}

		// Token: 0x0600188C RID: 6284 RVA: 0x0009CF3A File Offset: 0x0009B13A
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		// Token: 0x0600188D RID: 6285 RVA: 0x0009CF44 File Offset: 0x0009B144
		public new HSurfaceModel Clone()
		{
			HSerializedItem hserializedItem = this.SerializeSurfaceModel();
			HSurfaceModel hsurfaceModel = new HSurfaceModel();
			hsurfaceModel.DeserializeSurfaceModel(hserializedItem);
			hserializedItem.Dispose();
			return hsurfaceModel;
		}

		/// <summary>Free the memory of a surface model.</summary>
		/// <param name="surfaceModelID">Handle of the surface model.</param>
		// Token: 0x0600188E RID: 6286 RVA: 0x0009CF6C File Offset: 0x0009B16C
		public static void ClearSurfaceModel(HSurfaceModel[] surfaceModelID)
		{
			HTuple htuple = HHandleBase.ConcatArray(surfaceModelID);
			IntPtr proc = HalconAPI.PreCall(1036);
			HalconAPI.Store(proc, 0, htuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(surfaceModelID);
		}

		/// <summary>
		///   Free the memory of a surface model.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		// Token: 0x0600188F RID: 6287 RVA: 0x0009CFB0 File Offset: 0x0009B1B0
		public void ClearSurfaceModel()
		{
			IntPtr proc = HalconAPI.PreCall(1036);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Deserialize a surface model.
		///   Modified instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x06001890 RID: 6288 RVA: 0x0009CFE4 File Offset: 0x0009B1E4
		public void DeserializeSurfaceModel(HSerializedItem serializedItemHandle)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1037);
			HalconAPI.Store(proc, 0, serializedItemHandle);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}

		/// <summary>
		///   Serialize a surface_model.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x06001891 RID: 6289 RVA: 0x0009D038 File Offset: 0x0009B238
		public HSerializedItem SerializeSurfaceModel()
		{
			IntPtr proc = HalconAPI.PreCall(1038);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Read a surface model from a file.
		///   Modified instance represents: Handle of the read surface model.
		/// </summary>
		/// <param name="fileName">Name of the SFM file.</param>
		// Token: 0x06001892 RID: 6290 RVA: 0x0009D080 File Offset: 0x0009B280
		public void ReadSurfaceModel(string fileName)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1039);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write a surface model to a file.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06001893 RID: 6291 RVA: 0x0009D0CC File Offset: 0x0009B2CC
		public void WriteSurfaceModel(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1040);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Refine the pose of a surface model in a 3D scene.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="initialPose">Initial pose of the surface model in the scene.</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x06001894 RID: 6292 RVA: 0x0009D108 File Offset: 0x0009B308
		public HPose[] RefineSurfaceModelPose(HObjectModel3D objectModel3D, HPose[] initialPose, HTuple minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult[] surfaceMatchingResultID)
		{
			HTuple htuple = HData.ConcatArray(initialPose);
			IntPtr proc = HalconAPI.PreCall(1041);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.Store(proc, 2, htuple);
			HalconAPI.Store(proc, 3, minScore);
			HalconAPI.StoreS(proc, 4, returnResultHandle);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.UnpinTuple(minScore);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HTuple data;
			num = HTuple.LoadNew(proc, 0, num, out data);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			HPose[] result = HPose.SplitArray(data);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Refine the pose of a surface model in a 3D scene.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="initialPose">Initial pose of the surface model in the scene.</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x06001895 RID: 6293 RVA: 0x0009D1DC File Offset: 0x0009B3DC
		public HPose RefineSurfaceModelPose(HObjectModel3D objectModel3D, HPose initialPose, double minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult surfaceMatchingResultID)
		{
			IntPtr proc = HalconAPI.PreCall(1041);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.Store(proc, 2, initialPose);
			HalconAPI.StoreD(proc, 3, minScore);
			HalconAPI.StoreS(proc, 4, returnResultHandle);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(initialPose);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HPose result;
			num = HPose.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Find the best matches of a surface model in a 3D scene.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="relSamplingDistance">Scene sampling distance relative to the diameter of the surface model. Default: 0.05</param>
		/// <param name="keyPointFraction">Fraction of sampled scene points used as key points. Default: 0.2</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the surface model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x06001896 RID: 6294 RVA: 0x0009D2A4 File Offset: 0x0009B4A4
		public HPose[] FindSurfaceModel(HObjectModel3D objectModel3D, double relSamplingDistance, double keyPointFraction, HTuple minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult[] surfaceMatchingResultID)
		{
			IntPtr proc = HalconAPI.PreCall(1042);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.StoreD(proc, 2, relSamplingDistance);
			HalconAPI.StoreD(proc, 3, keyPointFraction);
			HalconAPI.Store(proc, 4, minScore);
			HalconAPI.StoreS(proc, 5, returnResultHandle);
			HalconAPI.Store(proc, 6, genParamName);
			HalconAPI.Store(proc, 7, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(minScore);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HTuple data;
			num = HTuple.LoadNew(proc, 0, num, out data);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			HPose[] result = HPose.SplitArray(data);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Find the best matches of a surface model in a 3D scene.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="relSamplingDistance">Scene sampling distance relative to the diameter of the surface model. Default: 0.05</param>
		/// <param name="keyPointFraction">Fraction of sampled scene points used as key points. Default: 0.2</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the surface model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x06001897 RID: 6295 RVA: 0x0009D370 File Offset: 0x0009B570
		public HPose FindSurfaceModel(HObjectModel3D objectModel3D, double relSamplingDistance, double keyPointFraction, double minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult surfaceMatchingResultID)
		{
			IntPtr proc = HalconAPI.PreCall(1042);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.StoreD(proc, 2, relSamplingDistance);
			HalconAPI.StoreD(proc, 3, keyPointFraction);
			HalconAPI.StoreD(proc, 4, minScore);
			HalconAPI.StoreS(proc, 5, returnResultHandle);
			HalconAPI.Store(proc, 6, genParamName);
			HalconAPI.Store(proc, 7, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HPose result;
			num = HPose.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Return the parameters and properties of a surface model.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="genParamName">Name of the parameter. Default: "diameter"</param>
		/// <returns>Value of the parameter.</returns>
		// Token: 0x06001898 RID: 6296 RVA: 0x0009D430 File Offset: 0x0009B630
		public HTuple GetSurfaceModelParam(HTuple genParamName)
		{
			IntPtr proc = HalconAPI.PreCall(1043);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the parameters and properties of a surface model.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="genParamName">Name of the parameter. Default: "diameter"</param>
		/// <returns>Value of the parameter.</returns>
		// Token: 0x06001899 RID: 6297 RVA: 0x0009D488 File Offset: 0x0009B688
		public HTuple GetSurfaceModelParam(string genParamName)
		{
			IntPtr proc = HalconAPI.PreCall(1043);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, genParamName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Create the data structure needed to perform surface-based matching.
		///   Modified instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model.</param>
		/// <param name="relSamplingDistance">Sampling distance relative to the object's diameter Default: 0.03</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		// Token: 0x0600189A RID: 6298 RVA: 0x0009D4D8 File Offset: 0x0009B6D8
		public void CreateSurfaceModel(HObjectModel3D objectModel3D, double relSamplingDistance, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1044);
			HalconAPI.Store(proc, 0, objectModel3D);
			HalconAPI.StoreD(proc, 1, relSamplingDistance);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
		}

		/// <summary>
		///   Create the data structure needed to perform surface-based matching.
		///   Modified instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="objectModel3D">Handle of the 3D object model.</param>
		/// <param name="relSamplingDistance">Sampling distance relative to the object's diameter Default: 0.03</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		// Token: 0x0600189B RID: 6299 RVA: 0x0009D550 File Offset: 0x0009B750
		public void CreateSurfaceModel(HObjectModel3D objectModel3D, double relSamplingDistance, string genParamName, string genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1044);
			HalconAPI.Store(proc, 0, objectModel3D);
			HalconAPI.StoreD(proc, 1, relSamplingDistance);
			HalconAPI.StoreS(proc, 2, genParamName);
			HalconAPI.StoreS(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(objectModel3D);
		}

		/// <summary>
		///   Find the best matches of a surface model in a 3D scene and images.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="image">Images of the scene.</param>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="relSamplingDistance">Scene sampling distance relative to the diameter of the surface model. Default: 0.05</param>
		/// <param name="keyPointFraction">Fraction of sampled scene points used as key points. Default: 0.2</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the surface model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x0600189C RID: 6300 RVA: 0x0009D5BC File Offset: 0x0009B7BC
		public HPose[] FindSurfaceModelImage(HImage image, HObjectModel3D objectModel3D, double relSamplingDistance, double keyPointFraction, HTuple minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult[] surfaceMatchingResultID)
		{
			IntPtr proc = HalconAPI.PreCall(2069);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.StoreD(proc, 2, relSamplingDistance);
			HalconAPI.StoreD(proc, 3, keyPointFraction);
			HalconAPI.Store(proc, 4, minScore);
			HalconAPI.StoreS(proc, 5, returnResultHandle);
			HalconAPI.Store(proc, 6, genParamName);
			HalconAPI.Store(proc, 7, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(minScore);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HTuple data;
			num = HTuple.LoadNew(proc, 0, num, out data);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			HPose[] result = HPose.SplitArray(data);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Find the best matches of a surface model in a 3D scene and images.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="image">Images of the scene.</param>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="relSamplingDistance">Scene sampling distance relative to the diameter of the surface model. Default: 0.05</param>
		/// <param name="keyPointFraction">Fraction of sampled scene points used as key points. Default: 0.2</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the surface model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x0600189D RID: 6301 RVA: 0x0009D698 File Offset: 0x0009B898
		public HPose FindSurfaceModelImage(HImage image, HObjectModel3D objectModel3D, double relSamplingDistance, double keyPointFraction, double minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult surfaceMatchingResultID)
		{
			IntPtr proc = HalconAPI.PreCall(2069);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.StoreD(proc, 2, relSamplingDistance);
			HalconAPI.StoreD(proc, 3, keyPointFraction);
			HalconAPI.StoreD(proc, 4, minScore);
			HalconAPI.StoreS(proc, 5, returnResultHandle);
			HalconAPI.Store(proc, 6, genParamName);
			HalconAPI.Store(proc, 7, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HPose result;
			num = HPose.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Refine the pose of a surface model in a 3D scene and in images.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="image">Images of the scene.</param>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="initialPose">Initial pose of the surface model in the scene.</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x0600189E RID: 6302 RVA: 0x0009D768 File Offset: 0x0009B968
		public HPose[] RefineSurfaceModelPoseImage(HImage image, HObjectModel3D objectModel3D, HPose[] initialPose, HTuple minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult[] surfaceMatchingResultID)
		{
			HTuple htuple = HData.ConcatArray(initialPose);
			IntPtr proc = HalconAPI.PreCall(2084);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.Store(proc, 2, htuple);
			HalconAPI.Store(proc, 3, minScore);
			HalconAPI.StoreS(proc, 4, returnResultHandle);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.UnpinTuple(minScore);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HTuple data;
			num = HTuple.LoadNew(proc, 0, num, out data);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			HPose[] result = HPose.SplitArray(data);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Refine the pose of a surface model in a 3D scene and in images.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="image">Images of the scene.</param>
		/// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
		/// <param name="initialPose">Initial pose of the surface model in the scene.</param>
		/// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
		/// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
		/// <param name="genParamName">Names of the generic parameters. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters. Default: []</param>
		/// <param name="score">Score of the found instances of the model.</param>
		/// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
		/// <returns>3D pose of the surface model in the scene.</returns>
		// Token: 0x0600189F RID: 6303 RVA: 0x0009D84C File Offset: 0x0009BA4C
		public HPose RefineSurfaceModelPoseImage(HImage image, HObjectModel3D objectModel3D, HPose initialPose, double minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult surfaceMatchingResultID)
		{
			IntPtr proc = HalconAPI.PreCall(2084);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 1, objectModel3D);
			HalconAPI.Store(proc, 2, initialPose);
			HalconAPI.StoreD(proc, 3, minScore);
			HalconAPI.StoreS(proc, 4, returnResultHandle);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(initialPose);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HPose result;
			num = HPose.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HSurfaceMatchingResult.LoadNew(proc, 2, num, out surfaceMatchingResultID);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			GC.KeepAlive(objectModel3D);
			return result;
		}

		/// <summary>
		///   Set parameters and properties of a surface model.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="genParamName">Name of the parameter. Default: "camera_parameter"</param>
		/// <param name="genParamValue">Value of the parameter.</param>
		// Token: 0x060018A0 RID: 6304 RVA: 0x0009D924 File Offset: 0x0009BB24
		public void SetSurfaceModelParam(string genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(2097);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamValue);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Set parameters and properties of a surface model.
		///   Instance represents: Handle of the surface model.
		/// </summary>
		/// <param name="genParamName">Name of the parameter. Default: "camera_parameter"</param>
		/// <param name="genParamValue">Value of the parameter.</param>
		// Token: 0x060018A1 RID: 6305 RVA: 0x0009D970 File Offset: 0x0009BB70
		public void SetSurfaceModelParam(string genParamName, double genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(2097);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, genParamName);
			HalconAPI.StoreD(proc, 2, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>Find boxes in 3D data.</summary>
		/// <param name="objectModel3DScene">Handle of 3D object model where to search the box.</param>
		/// <param name="sideLen1">Length of the first box side.</param>
		/// <param name="sideLen2">Length of the second box side.</param>
		/// <param name="sideLen3">Length of the third box side. Default: -1</param>
		/// <param name="minScore">Minimum score of the returned boxes. Default: 0.6</param>
		/// <param name="genParam">Dictionary for generic parameters. Default: []</param>
		/// <param name="score">Scores of the detected boxes.</param>
		/// <param name="objectModel3DBox">Detected boxes as triangulated 3D object models.</param>
		/// <param name="boxInformation">Additional debug information as dictionary.</param>
		/// <returns>Gripping poses of the detected boxes.</returns>
		// Token: 0x060018A2 RID: 6306 RVA: 0x0009D9B4 File Offset: 0x0009BBB4
		public static HPose[] FindBox3d(HObjectModel3D objectModel3DScene, HTuple sideLen1, HTuple sideLen2, HTuple sideLen3, HTuple minScore, HDict genParam, out HTuple score, out HObjectModel3D[] objectModel3DBox, out HDict boxInformation)
		{
			IntPtr proc = HalconAPI.PreCall(2181);
			HalconAPI.Store(proc, 0, objectModel3DScene);
			HalconAPI.Store(proc, 1, sideLen1);
			HalconAPI.Store(proc, 2, sideLen2);
			HalconAPI.Store(proc, 3, sideLen3);
			HalconAPI.Store(proc, 4, minScore);
			HalconAPI.Store(proc, 5, genParam);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(sideLen1);
			HalconAPI.UnpinTuple(sideLen2);
			HalconAPI.UnpinTuple(sideLen3);
			HalconAPI.UnpinTuple(minScore);
			HTuple data;
			num = HTuple.LoadNew(proc, 0, num, out data);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HObjectModel3D.LoadNew(proc, 2, num, out objectModel3DBox);
			num = HDict.LoadNew(proc, 3, num, out boxInformation);
			HalconAPI.PostCall(proc, num);
			HPose[] result = HPose.SplitArray(data);
			GC.KeepAlive(objectModel3DScene);
			GC.KeepAlive(genParam);
			return result;
		}

		/// <summary>Find boxes in 3D data.</summary>
		/// <param name="objectModel3DScene">Handle of 3D object model where to search the box.</param>
		/// <param name="sideLen1">Length of the first box side.</param>
		/// <param name="sideLen2">Length of the second box side.</param>
		/// <param name="sideLen3">Length of the third box side. Default: -1</param>
		/// <param name="minScore">Minimum score of the returned boxes. Default: 0.6</param>
		/// <param name="genParam">Dictionary for generic parameters. Default: []</param>
		/// <param name="score">Scores of the detected boxes.</param>
		/// <param name="objectModel3DBox">Detected boxes as triangulated 3D object models.</param>
		/// <param name="boxInformation">Additional debug information as dictionary.</param>
		/// <returns>Gripping poses of the detected boxes.</returns>
		// Token: 0x060018A3 RID: 6307 RVA: 0x0009DA84 File Offset: 0x0009BC84
		public static HPose FindBox3d(HObjectModel3D objectModel3DScene, HTuple sideLen1, HTuple sideLen2, HTuple sideLen3, double minScore, HDict genParam, out HTuple score, out HObjectModel3D[] objectModel3DBox, out HDict boxInformation)
		{
			IntPtr proc = HalconAPI.PreCall(2181);
			HalconAPI.Store(proc, 0, objectModel3DScene);
			HalconAPI.Store(proc, 1, sideLen1);
			HalconAPI.Store(proc, 2, sideLen2);
			HalconAPI.Store(proc, 3, sideLen3);
			HalconAPI.StoreD(proc, 4, minScore);
			HalconAPI.Store(proc, 5, genParam);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(sideLen1);
			HalconAPI.UnpinTuple(sideLen2);
			HalconAPI.UnpinTuple(sideLen3);
			HPose result;
			num = HPose.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out score);
			num = HObjectModel3D.LoadNew(proc, 2, num, out objectModel3DBox);
			num = HDict.LoadNew(proc, 3, num, out boxInformation);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(objectModel3DScene);
			GC.KeepAlive(genParam);
			return result;
		}
	}
}
